package com.blb.service.impl;

import com.blb.entity.ProductiveProcess;
import com.blb.mapper.ProductiveProcessMapper;
import com.blb.service.IProductiveProcessService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-21
 */
@Service
public class ProductiveProcessServiceImpl extends ServiceImpl<ProductiveProcessMapper, ProductiveProcess> implements IProductiveProcessService {

    @Resource
    private ProductiveProcessMapper productiveProcessMapper;

    @Override
    public void insertP(String no, int status) {
        ProductiveProcess productiveProcess = new ProductiveProcess();
        productiveProcess.setNo(no);
        productiveProcess.setStatus(status);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String time = format.format(new Date());
        productiveProcess.setTime(time);
        productiveProcessMapper.insert(productiveProcess);
    }

    @Override
    public List<Map<String,Object>> getProductiveProcessByNo(String no) {
        return productiveProcessMapper.getProductiveProcessByNo(no);
    }

    @Override
    public List<Map<String, Object>> getProductiveByNo(String cId,String no, int limit, int start) {
        return productiveProcessMapper.getProductiveByNo(cId,no,limit,start);
    }

    @Override
    public int count(String cId,String no) {
        return productiveProcessMapper.count(cId,no);
    }
}
